package com.kuzlak.cms.component;


import com.kuzlak.cms.config.ConstantHeader;
import com.kuzlak.cms.module.sys.service.SysSettingsService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class SystemSettingUtils {
    @Autowired
    private SysSettingsService service;





    public <T> T getInfo(String key) {
        T result = null;
        Map<String, Object> setting = ConstantHeader.getSetting();
        if (setting == null) {
            Map<String, Object> list = service.findByKeys();
            ConstantHeader.setSetting(list);

            result = (T) list.get(key);
        } else {
            result = (T) setting.get(key);
        }
        return result;
    }



}
